Java.perform(function () {

    var thread = Java.use('java.lang.Thread');
    var instance = thread.$new();

    function where(stack) {
        var at = ""
        for (var i = 0; i < stack.length; i++) {
            at += stack[i].toString() + "\n";
        }

        return at;
    }
     
   var runClz = Java.use('java.lang.Runtime')

  
   var intcase = null;
 
     //java层hook  Runtime.class的doload获取加载的so文件
	 runClz.doLoad.overload('java.lang.String', 'java.lang.ClassLoader').implementation = function (String,classloder) {

       var ret = this.doLoad(String,classloder);
        console.log("String : " + String );

        //获取so的基址
        var SoBaeAddress = Module.findBaseAddress("libyaqpro.7960f592.so");

        var dexBaeAddress = Module.findBaseAddress("gdt_plugin.dex");
        //根据偏移地址找到除导出函数外的native函数
        var point1 = parseInt(SoBaeAddress) + parseInt(0x47BD);

       var nativePointer1 = new NativePointer(point1);

          if (nativePointer1 != null) {
                Interceptor.attach(nativePointer1, {
                    onEnter: function (args) {
                        intcase = args[3];

                        if(intcase ==0xA2){
                        console.log("libyaqpro baseAddress: " + SoBaeAddress);
                        console.log("gdt_plugin baseAddress: " + dexBaeAddress);

                        console.log( "args[3]",args[3],"args[4]", args[4],"args[5]", ptr(args[5]),"args[6]", Memory.readCString(args[6]));
                        console.log(" called from :\n" + Thread.backtrace(this.context, Backtracer.FUZZY).map(DebugSymbol.fromAddress).join("\n") + "\n");

                        }

                    },
                    onLeave: function (retval) {

                    }
                });
            }

       return ret;

     };

});



